﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TOUR.SZHOME.Attributes;
using TOUR.SZHOME.BLL;
using TOUR.SZHOME.Entity;

namespace tour.szhome.manage.area.Controllers
{
    [SelfOnly]
    public class LandscapeImgController : Controller
    {
        //
        // GET: /LandscapeImg/
        Landscape_ImageBLL _limgbll = new Landscape_ImageBLL();

        /// <summary>
        /// 获取景区下的相册
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Index(int id = 0,string name = "")
        {
            ViewBag.ID = id;
            ViewBag.Name = name;
            ViewBag.List = _limgbll.GetListByJQID(id);
            ViewBag.uploadAddress = System.Configuration.ConfigurationManager.AppSettings["UploadAddress"];//获取上传文件地址 
            ViewBag.Folder = "thumb/";   //获取当前子文件夹
            return View();
        }

        /// <summary>
        /// 新增编辑
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [ActionName("json_edit")]
        public ActionResult Json_Edit(Landscape_ImageEntity model) 
        {
            return Json(_limgbll.Edit(model),JsonRequestBehavior.AllowGet);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="jid"></param>
        /// <returns></returns>
        [ActionName("json_delete")]
        public ActionResult Json_Del(int xid) 
        {
            return Json(_limgbll.DelByID(xid),JsonRequestBehavior.AllowGet);
        }
    }
}
